/**
 * Created By: sisopipo Project Team
 * Created Date: Mar 4, 2011
 */
package com.sisopipo.assetsportal.security.domain;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ribin
 * @version 1.0
 */
public class Function {

	/** kind: menu */
	public static final String KIND_MENU = "MENU";

	/** kind: function */
	public static final String KIND_FUNC = "FUNC";

	/** PK */
	private String id;

	/** function name */
	private String name;

	/** function code */
	private String code;

	/** function order(sort) */
	private String orderNo;

	/** funtion kind */
	private String kind;

	/** whether show checkbox on admin page */
	private Boolean showChkbox;

	/** parent function */
	private Function parent;

	/** children function */
	private List<Function> children = new ArrayList<Function>();

	/** belong to Roles */
	private List<Role> roles = new ArrayList<Role>();

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public String getKind() {
		return kind;
	}

	public void setKind(String kind) {
		this.kind = kind;
	}

	public Boolean getShowChkbox() {
		return showChkbox;
	}

	public void setShowChkbox(Boolean showChkbox) {
		this.showChkbox = showChkbox;
	}

	public Function getParent() {
		return parent;
	}

	public void setParent(Function parentFunction) {
		this.parent = parentFunction;
	}

	public List<Function> getChildren() {
		return children;
	}

	public void setChildren(List<Function> subFunctions) {
		this.children = subFunctions;
	}

	public void addChild(Function function) {
		this.children.add(function);
		function.setParent(this);
	}

	public List<Role> getRoles() {
		return roles;
	}

	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}

}
